<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:t="http://myfaces.apache.org/tomahawk">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="format.css" />
	<title><h:outputText
			value="#{displayAdvertisementsBean.selectedAdvertisement.title}" /></title>
</h:head>
<h:body>
	<ui:composition template="template.xhtml">
		<ui:define name="ui_right">
			<h:form id="wiadomosc"
				rendered="#{displayAdvertisementsBean.selectedAdvertisement.startDate != null}">
				
				<p:panel>
					<h3>
						<h:outputText
							value="#{displayAdvertisementsBean.selectedAdvertisement.title}" />
					</h3>
					<span class="daty">Ważne od: <b><h:outputText
								value="#{displayAdvertisementsBean.selectedAdvertisement.startDate}" /></b></span>
					<br />
					<span class="daty">Ważne do: <b><h:outputText
								value="#{displayAdvertisementsBean.selectedAdvertisement.expireDate}" /></b></span>
					<br />

					<!-- Tu będą znajdować się zdjęcia -->

					<p:commandButton type="button" style="width:30px; height:30px;"
						onclick="switcher.previous();" icon="ui-icon-circle-triangle-w" />
					<p:commandButton type="button" style="width:30px; height:30px;"
						onclick="switcher.next();" icon="ui-icon-circle-triangle-e" />
					<p:imageSwitch effect="wipe" widgetVar="switcher"
						slideshowAuto="true">
						<ui:repeat value="#{displayAdvertisementsBean.images}" var="image">
							<p:graphicImage style="max-width:350px; float:left;"
								value="#{image}" />
						</ui:repeat>
					</p:imageSwitch>

					<h:outputText
						value="#{displayAdvertisementsBean.selectedAdvertisement.content}" />
					<br />
					<br />
				</p:panel>
				<h:inputHidden
					value="displayAdvertisementsBean.selectedAdvertisement.category_id}" />
				<p>


					<p:panel
						style="background-color:#ddd; width:300px; margin-top:200px; display:block; ">
						<h:outputText value="Użytkownik: " />
						<b><h:outputText
								value="#{displayAdvertisementsBean.selectedAdvertisement.user.login}" /></b>
					</p:panel>
					<br />
					<p:panel
						style="background-color:#ddd; width:300px; margin:0px; display:block; "
						rendered="#{!displayAdvertisementsBean.selectedAdvertisement.user.firstName.isEmpty()}">
						<h:outputText value="Imię: " />
						<b><h:outputText
								value="#{displayAdvertisementsBean.selectedAdvertisement.user.firstName}" /></b>
					</p:panel>
					<br />
					<p:panel
						style="background-color:#ddd; width:300px; margin:0px; display:block; "
						rendered="#{!displayAdvertisementsBean.selectedAdvertisement.user.lastName.isEmpty()}">
						<h:outputText value="Nazwisko: " />
						<b><h:outputText
								value="#{displayAdvertisementsBean.selectedAdvertisement.user.lastName}" /></b>
					</p:panel>
					<br />
					<p:panel
						style="background-color:#ddd; width:300px; margin:0px; display:block; "
						rendered="#{!displayAdvertisementsBean.selectedAdvertisement.user.email.isEmpty()}">
						<h:outputText value="Adres e-mail: " />
						<b><h:outputText
								value="#{displayAdvertisementsBean.selectedAdvertisement.user.email}" /></b>
					</p:panel>
					<br />
					<p:panel
						style="background-color:#ddd; width:300px; margin:0px; display:block; "
						rendered="#{!displayAdvertisementsBean.selectedAdvertisement.user.phoneNumber.isEmpty()}">
						<h:outputText value="Numer telefonu: " />
						<b><h:outputText
								value="#{displayAdvertisementsBean.selectedAdvertisement.user.phoneNumber}" /></b>
					</p:panel>
					<br />
				</p>

			</h:form>
			<h:form
				rendered="#{displayAdvertisementsBean.selectedAdvertisement.startDate == null}">
				<p:growl/>
				<h3>Nie wybrano ogłoszenia!</h3>
			</h:form>

		</ui:define>
	</ui:composition>
</h:body>

</html>